package com.yo.example.consumer;

import com.yo.example.common.model.User;
import com.yo.example.common.service.UserService;
import com.yo.yorpc.config.RpcConfig;
import com.yo.yorpc.proxy.ServiceProxyFactory;
import com.yo.yorpc.utils.ConfigUtils;

public class ConsumerExample {
    public static void main(String[] args) {
        //获取代理
        UserService userService= ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("yo");
        //调用
        User newUser=userService.getUser(user);
        if(newUser!=null){
            System.out.println(newUser.getName());
        }else System.out.println("user==null");
        RpcConfig rpc= ConfigUtils.loadConfig(RpcConfig.class,"rpc");
        System.out.println(rpc.serverPort);
        long number=userService.getNumber();
        System.out.println(number);
    }
}
